package com.xinhe.web.reposity;

import com.xinhe.web.entity.Role;
import com.xinhe.web.entity.ServiceCenter;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface AuthRoleRepository extends JpaRepository<Role, Long> {
    @Query("from Role where fRoleId = ?1")
    List<Role> findAuthRoleById(Long fRoleId);
    @Query(value = "select r.*  from auth_role r  inner join auth_user_role ur on ur.f_role_id = r.id and ur.removed = 0 where r.removed = 0 and ur.f_user_id =?1",nativeQuery = true)
    List<Role> findByUserId(Long userId);
}